package subject_set.top101;

/**
 * @author haomin
 * @date 2022/11/03 21:24
 **/
public class BM18 {
    public class Solution {
        public boolean Find(int target, int [][] array) {
            if(array.length == 0 || array[0].length == 0) return false;
            int m = array.length, n = array[0].length;
            int i = 0, j = n-1;
            while(i < m && j >= 0){
                if(array[i][j] < target) i++;
                else if(array[i][j] > target) j--;
                else return true;
            }
            return false;
        }
    }

}